import axios from "axios";

export function insertEntity<T>(module: string, t: T | null): Promise<T> {
    return new Promise((resolve, reject) => {
        axios({method: 'post', url: `/api/${module}`, data: t}).then(value => {
            resolve(value.data);
        }).catch(reason => {
            console.log(reason);
            reject();
        })
    })
}